<template>
  <div>
    <!-- 头部固定的组件 -->
    <van-nav-bar
      :title="$route.meta.title"
      left-text="返回"
      right-text="按钮"
      left-arrow
      @click-left="onClickLeft"
    />
    <!-- 中间会变的组件，用router-view代替 -->
    <router-view></router-view>
    <!-- 底部固定的组件 -->
    <van-tabbar route>
      <!-- 路由模式,同设置route熟悉，使to和当前页面的地址匹配，就有选中效果 -->
      <van-tabbar-item to="/layout/index" icon="home-o">首页</van-tabbar-item>
      <van-tabbar-item to="/layout/cate" icon="search">分类</van-tabbar-item>
      <van-tabbar-item to="/layout/cart" icon="friends-o">购物车</van-tabbar-item>
      <van-tabbar-item to="/layout/my" icon="setting-o">我的</van-tabbar-item>
    </van-tabbar>
  </div>
</template>

<script>
import Vue from "vue";
import { Tabbar, TabbarItem } from "vant";

Vue.use(Tabbar);
Vue.use(TabbarItem);
import { NavBar } from "vant";

Vue.use(NavBar);
export default {
  data() {
    return {
      
    }
  },
  methods: {
    onClickLeft() {
      this.$router.back();
    },
  },
};
</script>

<style>
</style>